// pages/select/index.js
import api from '../../utils/api'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    selectQuestionMenu: '请选择',
    objectQuestionMenu: {},
    questionMenu: [],
    index: 0,
  },

  onLoad(e) {
    let _this = this;
    let token = wx.getStorageSync('token');
    api.get("evaluation?token="+token, {
    }).then(res => {
      console.log(res)
      if(res.data.length > 0){
          _this.setData({
            questionMenu:res.data
          })
      }
    }).catch(err => {
      wx.showToast({
        title: err.msg,
        icon: 'none'
      })
    })
  },

  /**
   * 开始答题
   */
  startAnswer(e) {
    let selectId = e.currentTarget.dataset.id;
    console.log(selectId)
    let url="";
    if(selectId == 1){
      url="/pages/component/pages/smyt/smyt"
    }else if(selectId == 2){
      url="/pages/component/pages/hxjzg/hxjzg"
    }else if(selectId == 3){
      console.log('1111')
      url="/pages/component/pages/mdjzg/mdjzg"
    }else if(selectId == 4){
      url="/pages/component/pages/4p/4p"
    }else if(selectId == 5){
      url="/pages/component/pages/VAKD/VAKD"
    }else if(selectId == 6){
      url="/pages/component/pages/holland/holland"
    }else if(selectId == 7){
      url="/pages/component/pages/MBTI/MBTI"
    }
    console.log(url)
    wx.navigateTo({
      url: url
    })
  }
})